package com.decent.util;

import com.decent.constant.Constant;
import com.decent.entity.GetOrderEntity;
import org.springframework.util.DigestUtils;


/**
 * @author decent
 */
public class Md5Util {

    public static String getMD5(GetOrderEntity entity) {
        String base = entity.getSupId() + "" + entity.getAmount() + "" + entity.getTimestamp() + Constant.SUP_SECRET_KEY;
        return DigestUtils.md5DigestAsHex(base.getBytes());
    }

    public static String getMD5(Integer supId, Integer amount, String timestamp, String supIdSecretKey) {
        String base = supId + "" + amount + "" + timestamp + "" + supIdSecretKey;
        return DigestUtils.md5DigestAsHex(base.getBytes());
    }
}
